package game;

import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;

public class TurnAppState extends AbstractAppState {
    protected TurnInputHandler inputHandler = new TurnInputHandler();
    protected boolean turnInputHandlerAttached = false;
    
    @Override
    public void stateAttached(AppStateManager stateManager) {
        super.stateAttached(stateManager);
    }
    
    @Override
    public void stateDetached(AppStateManager stateManager) {
        super.stateDetached(stateManager);
        if(isTurnInputHandlerAttached())
            detachTurnInputHandler();
    }

    public boolean isTurnInputHandlerAttached() {
	return turnInputHandlerAttached;
    }
    public void attachTurnInputHandler() {
	inputHandler.register();
	turnInputHandlerAttached = true;
    }
    public void detachTurnInputHandler() {
	DataStore.inputManager.removeListener(inputHandler);
	turnInputHandlerAttached = false;
    }
}
